]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Catch errors when reading devices
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 7 Mar 2019 19:26:12 +0000 (20:26 +0100)
committerMarco Trevisan <mail@3v1n0.net>
Wed, 27 Mar 2019 15:06:49 +0000 (15:06 +0000)
NetworkManager added support for a new device - NMDeviceWifiP2P - but
did not add the corresponding enum value in NMDeviceType. The return
value for nm_device_get_device_type() is therefore "illegal" for the
newly added device, and gjs throws an exception.

This should ultimately be fixed in libnm, but as errors when adding
one device shouldn't interfere with adding any other devices, catching
exception is a good idea anyway, so do just that.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1023

js/ui/status/network.js

index 77a6202b8747d73dbcb744609b2223afe4ee19b0..e6551f21714e41ab34da969a9f72f22517a9689f 100644 (file)
@@ -1673,7 +1673,11 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
     _readDevices() {
         let devices = this._client.get_devices() || [ ];
         for (let i = 0; i < devices.length; ++i) {
-            this._deviceAdded(this._client, devices[i], true);
+            try {
+                this._deviceAdded(this._client, devices[i], true);
+            } catch (e) {
+                log(`Failed to add device ${devices[i]}: ${e}`);
+            }
         }
         this._syncDeviceNames();
     }